<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .v-enter{
            opacity: 0;
            transform:translateX(-400px) ;
        }
        .v-enter-active{
            transition: all 1s ease;
            background-color: green;
        }
        .v-enter-to{
            opacity: 1;
            transform:translateX(0) ;
        }
        .v-leave{
            opacity: 1;
            transform:translateX(0) ;
        }
        .v-leave-active{
            transition: all 1s ease;
            background-color: red;
        }
        .v-leave-to{
            opacity: 0;
            transform:translateX(400px) ;
        }
      
    </style>
</head>
<body>
    <div id='app'>
        <button @click='flag=!flag'>切换动画</button>
        <transition appear duration="5000">
            <div v-show='flag' >让我将你心儿摘下</div>
        </transition>
        <transition>
            <div v-show='!flag'>试着将他慢慢融化</div>
        </transition>
    </div>
    <script>
    const vm = new Vue({
        el: '#app',
        data: {
            flag:true
        }
    })
    </script>
</body>
</html>